// server.js

const server = require('express')()
const createRenderer = require('vue-server-renderer').createRenderer

const createApp = require('./app')

server.get('*', (req, res) => {
    const context = { url: req.url }
    const app = createApp(context)
    console.log(app);

    const renderer = createRenderer({
        template: require('fs').readFileSync('./index.template.html', 'utf-8')
    })
    const data = {
        title: 'hello222',
        meta: `
    <meta ...>
  `}
    renderer.renderToString(app, data, (err, html) => {
        res.end(html)
    })

})

server.listen(8080)